<template>
  <div>
    <common-head title="添加联系人"/>
    <div class="wrap">
      <van-address-edit
        :area-list="area"
        show-postal
        show-delete
        show-set-default
        :area-columns-placeholder="['请选择', '请选择', '请选择']"
        @save="onSave"
        @delete="onDelete"
      />
    </div>
  </div>
</template>

<script>
import CommonHead from '@components/CommonHead'
import area from '@utils/area'
import { Toast } from 'vant'
export default {
  data () {
    return {
      area
    }
  },
  methods: {
    onSave (contact) {
      contact.id = Date.now()
      // 点击保存联系人
      this.$store.commit('contact/add_contact', contact)
      Toast('添加联系人成功')
      this.$router.push('/contactLists')
    },
    onDelete () {
      alert('删除')
    }
  },
  components: {
    CommonHead
  }
}
</script>

<style lang="scss" scoped>
.wrap{
  margin-top: 46px;
}
</style>
